package com.aerotechnic.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.aerotechnic.entities.User;
import com.aerotechnic.service.implementation.BOLayer;
import com.aerotechnic.service.implementation.UserBo;
import com.aerotechnic.service.interfaces.UserBoIn;

@Controller
public class LinkController {
	
	@Autowired
	UserBoIn userBo;
	
	@RequestMapping(value="/b")
	public ModelAndView mainPage() {
		
//		User fetchedUser =  userBo.authenticate("", "");
//		System.out.println("fetchedUser ====>"+fetchedUser);
		
		// instanciating user object
		
//		User user = new User();
//		user.setLogin("elmehdi.ghaffari2");
//		user.setNom("ghaffari");
//		user.setPrenom("el mehdi");
//		user.setPassword("65581990");
//		user.setProfile("Agent Planning");
		// let's save
		
//		userBo.save(user);
		
		// testing authentification
		
//		User fetchedUser = userBo.authenticate("elmehdi.ghaffari2", "65581990");
//		
//		System.out.println("authentification ====>"+fetchedUser);
		
		return new ModelAndView("home");
	}
	
	@RequestMapping(value="/index")    
	public ModelAndView indexPage() {
		return new ModelAndView("home");
	}
	
//	@RequestMapping(value="/menu")    
//	public ModelAndView menuPage() {
//		return new ModelAndView("menu");
//	}

}
